package com.gumanx;


import scala.languageFeature;
import net.minecraftforge.common.EnumHelper;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.ForgeHooks;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.Mod.PostInit;
import cpw.mods.fml.common.Mod.PreInit;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityEggInfo;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.item.EnumArmorMaterial;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemSeeds;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.stats.Achievement;
import net.minecraft.world.biome.BiomeGenBase;

@Mod(modid = "Gumanx", name = "Gumanx", version = "0.0.1")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class _GumanxModBase 
{
	
	@Instance("_GumanxModBase")
	public static _GumanxModBase instance;
	
	@SidedProxy(clientSide="com.gumanx.ClientProxy", serverSide="com.gumanx.CommonProxy")
	public static CommonProxy proxy;
	
	static int startEntityId = 851;		//Reserves the id for the mobs
	
	static EnumArmorMaterial Stellerium = EnumHelper.addArmorMaterial("Stellerium", 25, new int[]{3, 10, 6, 3}, 22);
	
	/**
	 * Adds the modded blocks and items to the game
	 */
	public static Block BlockArenaActivator = new com.gumanx.BlockArenaActivator(801, Material.rock).setUnlocalizedName("arenaActivator");
	public static Block BlockSpeedBooster = new com.gumanx.BlockSpeedBooster(802, Material.ice).setUnlocalizedName("road");
	public static Block BlockCropInertEnergy = new com.gumanx.BlockCropInertEnergy(803, Material.plants).setUnlocalizedName("cropInertEnergy");
	public static Block BlockOreTungsten = new com.gumanx.BlockOreTungsten(811).setUnlocalizedName("oreTungsten");
	public static Block BlockOreStellerium = new com.gumanx.BlockOreStellerium(812).setUnlocalizedName("oreStellerium");
	public static Block BlockWardBasic = new com.gumanx.BlockWardBasic(815, Material.glass, false).setUnlocalizedName("wardBasic");
	public static Block BlockWardHarming = new com.gumanx.BlockWardHarming(816, Material.glass, false).setUnlocalizedName("wardHarming");
	public static Block BlockBombAtomic = new com.gumanx.BlockBombAtomic(820).setUnlocalizedName("bombAtomic");
	public static Block BlockBombShiva = new com.gumanx.BlockBombShiva(821).setUnlocalizedName("bombShiva");
	
	public static Item ItemInertEnergy = new com.gumanx.ItemInertEnergy(5000).setUnlocalizedName("inertEnergy");
	public static Item ItemIngotTungsten = new com.gumanx.ItemIngotTungsten(5001).setUnlocalizedName("ingotTungsten");
	public static Item ItemIngotStellerium = new com.gumanx.ItemIngotStellerium(5002).setUnlocalizedName("ingotStellerium");
	public static Item ItemIngotXerorium = new com.gumanx.ItemIngotXerorium(5003).setUnlocalizedName("ingotXerorium");
	public static Item ItemSuperXPBottle = new com.gumanx.ItemSuperXPBottle(5050).setUnlocalizedName("superXPBottle");
	public static Item ItemBombThrowable = new com.gumanx.ItemBombThrowable(5051).setUnlocalizedName("bombThrowable");
	public static Item ItemBombThrowableLightning = new com.gumanx.ItemBombThrowableLightning(5052).setUnlocalizedName("bombThrowableLightning");
	public static Item ItemPotionNitricAcid = new com.gumanx.ItemPotionNitricAcid(5053).setUnlocalizedName("nitricAcid");
	public static Item ItemInstantHouse = new com.gumanx.ItemInstantHouse(5054).setUnlocalizedName("instantHouse");
	public static ItemSeeds ItemSeedsInertEnergy = new com.gumanx.ItemSeedsInertEnergy(5055, _GumanxModBase.BlockCropInertEnergy.blockID, Block.tilledField.blockID);
	public static Item ItemStaffScythe = new com.gumanx.ItemStaffScythe(5010, EnumToolMaterial.EMERALD).setUnlocalizedName("staffScythe");
	public static Item ItemStaffTeleportaion = new com.gumanx.ItemStaffTeleportation(5011).setUnlocalizedName("staffTeleportation");
	public static Item ItemStaffExplosion = new com.gumanx.ItemStaffExplosion(5012).setUnlocalizedName("staffExplosion");
	public static Item ItemStaffLightning = new com.gumanx.ItemStaffLightning(5013).setUnlocalizedName("staffLightning");
	public static Item ItemSwordTungsten = new com.gumanx.ItemSwordTungsten(5021, EnumToolMaterial.EMERALD).setUnlocalizedName("swordTungsten");
	public static Item ItemSwordStellerium = new com.gumanx.ItemSwordStellerium(5022, EnumToolMaterial.EMERALD).setUnlocalizedName("swordStellerium");
	public static Item ItemSwordXerorium = new com.gumanx.ItemSwordXerorium(5023, EnumToolMaterial.EMERALD).setUnlocalizedName("swordXerorium");
	public static Item ItemBowStellerium = new com.gumanx.ItemBowStellerium(5024).setUnlocalizedName("bowStellerium");
	public static Item ItemWeaponBlasterRifle = new com.gumanx.ItemWeaponBlasterRifle(5025).setUnlocalizedName("rifleBlaster");
	
	public static Item ItemArmorHelmetStellerium;
	public static Item ItemArmorChestplateStellerium;
	public static Item ItemArmorLeggingsStellerium;
	public static Item ItemArmorBootsStellerium;
	
	@PreInit
	public void preInit(FMLPreInitializationEvent event)
	{
	}
	@Init
	public void load(FMLInitializationEvent event)
	{
		util.recipes();		//Load the recipes
		
		/**
		 * Adds the mobs and their spawn eggs
		 */
		ClientProxy.registerRenderThings();
		EntityRegistry.registerModEntity(EntityMobMagicZombie.class, "Magic_Zombie", 850, this, 80, 1, true);
		EntityRegistry.registerModEntity(EntityMobKraken.class, "Kraken", 851, this, 80, 1, true);
		EntityRegistry.addSpawn(EntityMobMagicZombie.class, 3, 2, 5, EnumCreatureType.monster, BiomeGenBase.beach, BiomeGenBase.extremeHills, BiomeGenBase.extremeHillsEdge, BiomeGenBase.forest, BiomeGenBase.forestHills, BiomeGenBase.jungle, BiomeGenBase.jungleHills, BiomeGenBase.mushroomIsland, BiomeGenBase.mushroomIslandShore, BiomeGenBase.ocean, BiomeGenBase.plains, BiomeGenBase.river, BiomeGenBase.swampland);
		LanguageRegistry.instance().addStringLocalization("entity.Gumanx.Magic_Zombie.name", "Magic Zombie");
		LanguageRegistry.instance().addStringLocalization("entity.Gumanx.Kraken.name", "Kraken");
		registerEntityEgg(EntityMobMagicZombie.class, 0xffffff, 0x000000);
		registerEntityEgg(EntityMobKraken.class, 0xffffff, 0x000000);
		
		GameRegistry.registerWorldGenerator(new WorldGenerator());		//Adds the ore generation to the world
		
		proxy.registerRenderers();
		ItemArmorHelmetStellerium = new ItemArmorStellerium(5032, Stellerium, proxy.addArmor("Stellerium Helmet"), 0).setUnlocalizedName("helmetStellerium");
		ItemArmorChestplateStellerium = new ItemArmorStellerium(5033, Stellerium, proxy.addArmor("Stellerium Chestplate"), 1).setUnlocalizedName("chestplateStellerium");
		ItemArmorLeggingsStellerium = new ItemArmorStellerium(5034, Stellerium, proxy.addArmor("Stellerium Leggings"), 2).setUnlocalizedName("legsStellerium");
		ItemArmorBootsStellerium = new ItemArmorStellerium(5035, Stellerium, proxy.addArmor("Stellerium Boots"), 3).setUnlocalizedName("bootsStellerium");
		
		/**
		 * Register the blocks
		 */
		GameRegistry.registerBlock(BlockArenaActivator, BlockArenaActivator.getUnlocalizedName());
		GameRegistry.registerBlock(BlockSpeedBooster, BlockSpeedBooster.getUnlocalizedName());
		GameRegistry.registerBlock(BlockCropInertEnergy, BlockCropInertEnergy.getUnlocalizedName());
		GameRegistry.registerBlock(BlockOreTungsten, BlockOreTungsten.getUnlocalizedName());
		GameRegistry.registerBlock(BlockOreStellerium, BlockOreStellerium.getUnlocalizedName());
		GameRegistry.registerBlock(BlockWardBasic, BlockWardBasic.getUnlocalizedName());
		GameRegistry.registerBlock(BlockWardHarming, BlockWardHarming.getUnlocalizedName());
		GameRegistry.registerBlock(BlockBombAtomic, BlockBombAtomic.getUnlocalizedName());
		GameRegistry.registerBlock(BlockBombShiva, BlockBombShiva.getUnlocalizedName());
		
		/**
		 * Give the blocks and items names
		 */
		LanguageRegistry.addName(BlockArenaActivator, "Arena Activator");
		LanguageRegistry.addName(BlockSpeedBooster, "Speed Booster");
		LanguageRegistry.addName(BlockOreTungsten, "Tungsten Ore");
		LanguageRegistry.addName(BlockOreStellerium, "Stellerium Ore");
		LanguageRegistry.addName(BlockWardBasic, "Basic Ward");
		LanguageRegistry.addName(BlockWardHarming, "Harming Ward");
		LanguageRegistry.addName(BlockBombAtomic, "Atomic Bomb");
		LanguageRegistry.addName(BlockBombShiva, "Shiva");
		
		LanguageRegistry.addName(ItemSuperXPBottle, "Super XP Bottle");
		LanguageRegistry.addName(ItemBombThrowable, "Grenade");
		LanguageRegistry.addName(ItemBombThrowableLightning, "Lightning Grenade");
		LanguageRegistry.addName(ItemPotionNitricAcid, "Nitric Acid");
		LanguageRegistry.addName(ItemInstantHouse, "Instant House Maker");
		LanguageRegistry.addName(ItemSeedsInertEnergy, "Inert Energy Seeds");
		LanguageRegistry.addName(ItemInertEnergy, "Inert Energy");
		LanguageRegistry.addName(ItemIngotTungsten, "Tungsten Ingot");
		LanguageRegistry.addName(ItemIngotStellerium, "Stellerium Ingot");
		LanguageRegistry.addName(ItemIngotXerorium, "Xerorium Ingot");
		LanguageRegistry.addName(ItemStaffScythe, "Scythe");
		LanguageRegistry.addName(ItemStaffTeleportaion, "Staff of Teleportation");
		LanguageRegistry.addName(ItemStaffExplosion, "Staff of Explosions");
		LanguageRegistry.addName(ItemStaffLightning, "Zeus' Lightning Bolt");
		LanguageRegistry.addName(ItemSwordTungsten, "Tungsten Sword");
		LanguageRegistry.addName(ItemSwordStellerium, "Stellerium Sword");
		LanguageRegistry.addName(ItemSwordXerorium, "Xerorium Sword");
		LanguageRegistry.addName(ItemBowStellerium, "Stellerium Bow");
		LanguageRegistry.addName(ItemWeaponBlasterRifle, "Blaster Rifle");
		LanguageRegistry.addName(ItemArmorHelmetStellerium, "Stellerium Helmet");
		LanguageRegistry.addName(ItemArmorChestplateStellerium,  "Stellerium Chestplate");
		LanguageRegistry.addName(ItemArmorLeggingsStellerium, "Stellerium Leggings");
		LanguageRegistry.addName(ItemArmorBootsStellerium, "Stellerium Boots");
	}
	
	public static int getUniqueEntityId() 
	{
		do 
		{
			startEntityId++;
		} 
		while (EntityList.getStringFromID(startEntityId) != null);

		return startEntityId;
	}

	public static void registerEntityEgg(Class<? extends Entity> entity, int primaryColor, int secondaryColor) 
	{
		int id = getUniqueEntityId();
		EntityList.IDtoClassMapping.put(id, entity);
		EntityList.entityEggs.put(id, new EntityEggInfo(id, primaryColor, secondaryColor));
	}
	
	@PostInit 
	public void postInit(FMLPostInitializationEvent event)
	{
	}
}
